package com.example.mylibrarybase.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListView;

import com.jingchen.pulltorefresh.pullableview.Pullable;

/**
 * Created by Administrator 于萌萌
 * 创建日期: 16:31 . 2016年07月22日
 * 描述: 不能滑动的listView
 * <p/>
 * <p/>
 * 备注:
 */
public class NoScroolListView extends ListView implements Pullable {
    public NoScroolListView(Context context) {
        super(context);
    }

    public NoScroolListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public NoScroolListView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }


//    //不出现滚动条
//    @Override
//    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//
//        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
//        super.onMeasure(widthMeasureSpec, expandSpec);
//    }

    @Override
    public boolean canPullDown()
    {
        if (getScrollY() == 0)
            return true;
        else
            return false;
    }

    @Override
    public boolean canPullUp()
    {
        if (getScrollY() >= (getChildAt(0).getHeight() - getMeasuredHeight()))
            return true;
        else
            return false;
    }
}

